<template>
  <div class="app-container calendar-list-container">
    <el-tabs type="card" v-model="activeTab">
      <!-- 新产品报价单  -->
      <el-tab-pane v-if="newQ" label="新产品" name="newQuotation">
        <new-quotation ref="newQuotation"></new-quotation>
      </el-tab-pane>
      <!-- 老产品报价单 -->
      <el-tab-pane v-if="oldQ" label="老产品" name="oldQuotation">
        <old-quotation ref="oldQuotation"></old-quotation>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import { mapGetters } from "vuex";
import EditRefresh from "@/components/Mixin/editRefresh.js";

export default {
  components: {
    "new-quotation": () => import("./components/newQuotation"),
    "old-quotation": () => import("./components/oldQuotation")
  },
  mixins: [EditRefresh],
  data() {
    return {
      activeTab: "newQuotation",
      newQ: false,
      oldQ: false
    };
  },
  computed: {
    ...mapGetters(["elements"])
  },
  created() {
    this.setActive();
  },
  methods: {
    setActive() {

    },

    refresh() {
    
            console.log('quoteType',this.$route.query.quoteType)
      if( this.$route.query.quoteType == 0 ) {
               this.newQ = false;
               this.oldQ = true;
                this.activeTab = "oldQuotation";
               
      }else {
               this.newQ = true;
               this.oldQ = false;
              this.activeTab = "newQuotation";
      }   
      this.$refs.category &&
        this.$refs.category.refresh &&
        this.$refs.category.refresh();
      this.$refs.product &&
        this.$refs.product.refresh &&
        this.$refs.product.refresh();
      this.$refs.doc && this.$refs.doc.refresh && this.$refs.doc.refresh();
      this.$refs.pcc && this.$refs.pcc.refresh && this.$refs.pcc.refresh();
    }
  }
};
</script>
